package org.neptune.api.entity;

import org.neptune.common.util.DateUtil;

import com.alibaba.fastjson.JSON;

/**
 * @author lwl
 * @date 2019/11/22 16:23
 */
public class Message {

	public static final String ENTER = "ENTER";

	public static final String SPEAK = "SPEAK";

	public static final String QUIT = "QUIT";

	private String type;// 消息类型

	private String username; // 发送人

	private String msg; // 发送消息

	private int onlineCount; // 在线用户数

	private String nowStr;// 当前时间

	public static String jsonStr(String type, String username, String msg, int onlineTotal) {
		return JSON.toJSONString(new Message(type, username, msg, onlineTotal));
	}

	public Message(String type, String username, String msg, int onlineCount) {
		this.type = type;
		this.username = username;
		this.msg = msg;
		this.onlineCount = onlineCount;
		this.nowStr = DateUtil.getNowDayStr();
	}

	public static String getENTER() {
		return ENTER;
	}

	public static String getSPEAK() {
		return SPEAK;
	}

	public static String getQUIT() {
		return QUIT;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public int getOnlineCount() {
		return onlineCount;
	}

	public void setOnlineCount(int onlineCount) {
		this.onlineCount = onlineCount;
	}

	/**
	 * @return the nowStr
	 */
	public String getNowStr() {
		return nowStr;
	}

	/**
	 * @param nowStr
	 *            the nowStr to set
	 */
	public void setNowStr(String nowStr) {
		this.nowStr = nowStr;
	}

}
